import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HrLeaveApplyVO, HrLeaveApplyForm, HrLeaveApplyQuery } from '@/api/general/humanresources/leave/types';

/**
 * 查询员工请假申请审批列表
 * @param query
 * @returns {*}
 */

export const listHrLeaveApply = (query?: HrLeaveApplyQuery): AxiosPromise<HrLeaveApplyVO[]> => {
  return request({
    url: '/humanresource/hrLeaveApply/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询员工请假申请审批详细
 * @param id
 */
export const getHrLeaveApply = (id: string | number): AxiosPromise<HrLeaveApplyVO> => {
  return request({
    url: '/humanresource/hrLeaveApply/' + id,
    method: 'get'
  });
};

/**
 * 新增员工请假申请审批
 * @param data
 */
export const addHrLeaveApply = (data: HrLeaveApplyForm) => {
  return request({
    url: '/humanresource/hrLeaveApply',
    method: 'post',
    data: data
  });
};

/**
 * 修改员工请假申请审批
 * @param data
 */
export const updateHrLeaveApply = (data: HrLeaveApplyForm) => {
  return request({
    url: '/humanresource/hrLeaveApply',
    method: 'put',
    data: data
  });
};

/**
 * 删除员工请假申请审批
 * @param id
 */
export const delHrLeaveApply = (id: string | number | Array<string | number>) => {
  return request({
    url: '/humanresource/hrLeaveApply/' + id,
    method: 'delete'
  });
};
